from socket import *


tcp_socket = socket(AF_INET, SOCK_STREAM)
tcp_socket.bind(("0.0.0.0", 8888))
tcp_socket.listen()

print("Waiting for a connect... ...")
conn, addr = tcp_socket.accept()
print("Connect has been done...", addr)

fw = open("./new.jpg", "wb")
while True:
    data = conn.recv(1024)
    if not data:
        break
    fw.write(data)
fw.close()
conn.close()
tcp_socket.close()
